<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set value="<%=request.getContextPath()%>" var="ctx"></c:set>
<%
	String message = (String) request.getParameter("message");
%>
<html>
<head>
<meta charset="utf-8">
<title>登录</title>
<link href="${ctx}/assert/css/css.css" rel="stylesheet" type="text/css"/>
<script src="${ctx}/assert/js/jquery.js"></script>
<%-- <link rel="stylesheet"  href="${ctx}/assert/css/validation.css"> --%>
<script type="text/javascript" src="${ctx}/assert/js/jquery.min.js" ></script>
<script type="text/javascript" src="${ctx}/assert/js/jquery.validate.min.js" ></script>
<script type="text/javascript" src="${ctx}/assert/js/md5.js"></script>
<script>
$(function(){
	$('.logo_text input').focus(function(){
	 $(this).addClass('focus');
	});
	$('.logo_text input').blur(function(){
		$(this).removeClass('focus');
	});
	$('.bg_btn .001').click(function(){
		$('.logo_bg').css({'background':'url(${ctx}/assert/images/logo_bg1.jpg) no-repeat top center'});
		$('.bg_btn a').removeClass('active');
		$(this).addClass('active');
	});
	$('.bg_btn .002').click(function(){
		$('.logo_bg').css({'background':'url(${ctx}/assert/images/logo_bg2.jpg) no-repeat top center'});
		$('.bg_btn a').removeClass('active');
		$(this).addClass('active');
	});
	$('.bg_btn .003').click(function(){
		$('.logo_bg').css({'background':'url(${ctx}/assert/images/logo_bg3.jpg) no-repeat top center'});
		$('.bg_btn a').removeClass('active');
		$(this).addClass('active');
	});	
	$("#fcrmLoginForm").validate({
		debug : false,
		rules : {
			username : {
				required : true,
				minlength : 2
			},
			pwd : {
				required : true,
				minlength : 2
			}
		},
		messages : {
			username : {
				required : "*必须填写用户名",
				minlength : "*用户名最小为两位"
			},
			pwd : {
				required : "*必须填写密码",
				minlength : "*密码最小为两位"
			}
		}
	});
	//给enter键添加点击事件
	document.onkeyup = function (e) {
        if (e.keyCode == 13) {  //判断是否单击的enter按键(回车键)
        	$("#btnSubmit").click(); 
        }
}
});

function loginBtnClick(){
	$("#errMsg").html("");
	if(!$("#fcrmLoginForm").valid()){
		return;
	}else{
		var pwdMd5 = hex_md5($("#pwd").val());
		$("#pwd").val(pwdMd5);
		$("#fcrmLoginForm").submit();
	}
}
</script>

</head>
<body>
<div class="bg_btn">
<a class="001 active"><img src="${ctx}/assert/images/logo_bg1.jpg" width="50px" height="50px"/></a>
<a class="002"><img src="${ctx}/assert/images/logo_bg2.jpg" width="50px" height="50px"/></a>
<a class="003"><img src="${ctx}/assert/images/logo_bg3.jpg" width="50px" height="50px"/></a>
</div>
	<div class="logo_bg">
		  <div class="logo_main">
		     <div class="logo_top">
		       <img src="${ctx}/assert/images/logo.png" width="80px"/>
		     </div>
		    
		     	<form id="fcrmLoginForm" action="${ctx}/admin/logining" method="post">
		     	 
		     <div class="logo_center">
		     <h5 class="logo_title">千里码数据服务有限公司</h5>
		       <div class="logo_text">
		           <span class="user"></span>
		           <input type="text" name="username" id="username" value=""  placeholder="请输入用户名"/>
		       </div>
		       <div class="logo_text">
		           <span class="password"></span>
		            <input type="password" name="pwd" id="pwd" value="" placeholder="请输入密码"/>
		       </div>  
		       <input type="button" id="btnSubmit" value="登录"  class="logo_btn" onclick="loginBtnClick();return false;"/>
				<%
					if (message != null) {
				%>
				<div id="msgDiv">
					<label id="errMsg" style="color: red">*<%=message%></label>
				</div>
				<%
					}
				%> 
		     </div>
		     </form>
		     <div class="logo_bttom">FCRM-千里码数据服务有限公司</div> 
		  </div>
		</div>
</body>
</html>
